<?php
	header('content-type:text/html;charset=utf8');
	
/**
 * 创建提示函数
 * @param string $xinxi 提示信息
 * @param string $zhuantiao 跳转的页面
 */
	function tishi($xinxi,$zhuantiao){
		$zan=<<<zan
		<script>
		    alert('$xinxi');
		    location.href="$zhuantiao";
	    </script>
zan;
        echo $zan;
		die;
	}
	
	require_once("./functions.php");
	
	if($_SERVER['REQUEST_METHOD']){
		$mail = $_POST['qqMail'];
		$title = $_POST['title'];
		$content = $_POST['contents'];
		$flag = sendMail($mail,$title,$content);
		if($flag){
		    tishi('邮件发送成功！','../index.html');
		}else{
		    tishi('邮件发送失败！','../index.html');
		}
	}
?>
